package com.cookie.framework.helper;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;

/**
 * 项目名:    MeetProject
 * 包名:      com.cookie.framework.helper
 * 文件名:    FlavorHelper
 * 创建者:    cookie
 * 创建时间:   2020/6/3 22:48
 * 描述:      多渠道帮助类
 */

public class FlavorHelper {

    //获取渠道号
    public static String getFlavor(Context context){
        PackageManager pm = context.getPackageManager();
        try {
            ApplicationInfo info = pm.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            Bundle bundle = info.metaData;
            return bundle.getString("APP_CHANNEL_VALUE");
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return "";
    }
}
